/*
 * Tf: a unit test framework for C
 * Copyright (C) 2012 zrezek at gmail.com
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3.0 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
#if !defined MONEY_H
#define MONEY_H

/// Money representation.
/// The currency and ammount fields are subject to change
/// in future versions. Applications should use money apis
/// to read / modify money state.
typedef struct
{
    const char* currency;
    double ammount;
} money_t;

/// Initialize money_t structure with supplied values.
void money_init(money_t* money, const char* currency, double ammount);

/// Obtain currency.
const char* money_get_currency(money_t* money);

/// Obtain ammount.
double money_get_ammount(money_t* money);

/// Add m1 and m2 and store result in dst.
/// Dst may be the same pointer as m1 or m2.
/// Return nonzero value on success.
int money_add(money_t* dst, const money_t* m1, const money_t* m2);

/// Compare moneys. Follow C comparing convention (strcmp, memcmp)
/// and return 0 if both objects are equal, nonzero value otherwise.
int money_cmp(const money_t* m1, const money_t* m2);

#endif // MONEY_H
